home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 426-450 / disk_436 / aztecarp / arpbase.h < prev    next >
C/C++ Source or Header  |  1992-05-06  |  49KB  |  1,181 lines

  1. #ifndef    LIBRARIES_ARPBASE_H
  2. #define    LIBRARIES_ARPBASE_H 1
  3.  
  4. /*
  5.  ************************************************************************
  6.  *                                    *
  7.  * 5/3/89    ARPbase.h    by MKSoft from ARPbase.i by SDB        *
  8.  *                                    *
  9.  ************************************************************************
  10.  *                                    *
  11.  *    AmigaDOS Resource Project -- Library Include File        *
  12.  *                     for Lattice C 5.x or Manx C 5.x    *
  13.  *                                    *
  14.  ************************************************************************
  15.  *                                    *
  16.  *    Copyright (c) 1987/1988/1989 by Scott Ballantyne        *
  17.  *                                    *
  18.  *    The arp.library, and related code and files may be freely used    *
  19.  *    by supporters of ARP.  Modules in the arp.library may not be    *
  20.  *    extracted for use in independent code, but you are welcome to    *
  21.  *    provide the arp.library with your work and call on it freely.    *
  22.  *                                    *
  23.  *    You are equally welcome to add new functions, improve the ones    *
  24.  *    within, or suggest additions.                    *
  25.  *                                    *
  26.  *    BCPL programs are not welcome to call on the arp.library.    *
  27.  *    The welcome mat is out to all others.                *
  28.  *                                    *
  29.  ************************************************************************
  30.  *                                    *
  31.  * N O T E !  You MUST! have IoErr() defined as LONG to use LastTracker *
  32.  *          If your compiler has other defines for this, you may wish *
  33.  *          to remove the prototype for IoErr() from this file.    *
  34.  *                                    *
  35.  ************************************************************************
  36.  */
  37.  
  38. /*
  39.  ************************************************************************
  40.  *    First we need to include the Amiga Standard Include files...    *
  41.  ************************************************************************
  42.  */
  43. #ifndef    EXEC_TYPES_H
  44. #include <exec/types.h>
  45. #endif    /* EXEC_TYPES_H */
  46.  
  47. #ifndef    EXEC_LISTS_H
  48. #include <exec/lists.h>
  49. #endif    /* EXEC_LISTS_H */
  50.  
  51. #ifndef    EXEC_ALERTS_H
  52. #include <exec/alerts.h>
  53. #endif    /* EXEC_ALERTS_H */
  54.  
  55. #ifndef    EXEC_LIBRARIES_H
  56. #include <exec/libraries.h>
  57. #endif    /* EXEC_LIBRARIES_H */
  58.  
  59. #ifndef    EXEC_SEMAPHORES_H
  60. #include <exec/semaphores.h>
  61. #endif    /* EXEC_SEMAPHORES_H */
  62.  
  63. #ifndef    LIBRARIES_DOS_H
  64. #include <libraries/dosextens.h>
  65. #endif    /* LIBRARIES_DOS_H */
  66.  
  67. /*
  68.  ************************************************************************
  69.  *    Check for MANX/Lattice and define the differences...        *
  70.  ************************************************************************
  71.  *    At the moment MANX 3.6 does not have prototypes or the        *
  72.  *    wonderful #pragma statements of Lattice 5.0...            *
  73.  *    And, no __stdargs in MANX either...                *
  74.  ************************************************************************
  75.  */
  76. #ifdef    AZTEC_C
  77.  
  78.     /* Do we have an old 3.6a compiler? -olsen */
  79.  
  80. #ifndef __VERSION
  81. #define __VERSION 360
  82. #endif    /* __VERSION */
  83.  
  84.     /* If this is an old compiler, don't confuse it with
  85.      * ANSI prototypes and pragmas. -olsen
  86.      */
  87.  
  88. #if __VERSION < 500
  89. #define    NO_PRAGMAS    1
  90. #define NO_PROTOTYPES    1
  91. #endif    /* __VERSION */
  92.  
  93. #define    C_Args
  94.  
  95. #endif    /* AZTEC_C */
  96.  
  97. #ifdef    LATTICE
  98.  
  99. #define    C_Args    __stdargs
  100.  
  101. #endif    /* LATTICE */
  102.  
  103. /*
  104.  ************************************************************************
  105.  *    Standard definitions for arp library information        *
  106.  ************************************************************************
  107.  */
  108. #define    ArpName        "arp.library"    /* Name of library... */
  109. #define    ArpVersion    39L        /* Current version... */
  110.  
  111. /*
  112.  ************************************************************************
  113.  *    The current ARP library node...                    *
  114.  ************************************************************************
  115.  */
  116. struct    ArpBase    {
  117.     struct    Library            LibNode;     /* Standard library node        */
  118.         APTR            DosRootNode;     /* Copy of dl_Root            */
  119.         UBYTE            Flags;         /* See bitdefs below            */
  120.         UBYTE            ESCChar;      /* Character to be used for escaping    */
  121.         LONG            ArpReserved1;     /* ArpLib's use only!!            */
  122.     struct    Library            *EnvBase;      /* Dummy library for MANX compatibility*/
  123.     struct    Library            *DosBase;      /* Cached DosBase            */
  124.     struct    Library            *GfxBase;      /* Cached GfxBase            */
  125.     struct    Library            *IntuiBase;     /* Cached IntuitionBase        */
  126.     struct    MinList            ResLists;     /* Resource trackers            */
  127.     struct    ResidentProgramNode    *ResidentPrgList;/* Resident Programs.            */
  128.     struct    SignalSemaphore        ResPrgProtection;/* protection for above        */
  129.         BPTR            SegList;      /* Pointer to loaded libcode (a BPTR).    */
  130.         };
  131.  
  132. /*
  133.  ************************************************************************
  134.  *    The following is here *ONLY* for information and for        *
  135.  *    compatibility with MANX.  DO NOT use in new code!        *
  136.  ************************************************************************
  137.  */
  138. #ifdef    ARP_PRIVATE
  139. struct EnvBase {
  140.     struct    Library    LibNode;    /* Standard library node for linkage    */
  141.         BYTE    *EnvSpace;    /* Access only when Forbidden!        */
  142.         ULONG    EnvSize;    /* Total allocated mem for EnvSpace    */
  143.     struct    ArpBase    *ArpBase;    /* Added in V32 for Resource Tracking    */
  144.         };
  145. #endif    /* ARP_PRIVATE */
  146.  
  147. /*
  148.  ************************************************************************
  149.  *    These are used in release 33.4 but not by the library code.    *
  150.  *    Instead, individual programs check for these flags.        *
  151.  ************************************************************************
  152.  */
  153. #define    ARPB_WILD_WORLD 0L        ; Mixed BCPL/Normal wildcards.
  154. #define    ARPB_WILD_BCPL  1L        ; Pure BCPL wildcards.
  155.  
  156. #define    ARPF_WILD_WORLD (1L << ARPB_WILD_WORLD)
  157. #define    ARPF_WILD_BCPL  (1L << ARPB_WILD_BCPL)
  158.  
  159. /*
  160.  ************************************************************************
  161.  * The alert object is what you use if you really must return an alert    *
  162.  * to the user. You would normally OR this with another alert number    *
  163.  * from the alerts.h file. Generally, should be NON deadend alerts.    *
  164.  *                                    *
  165.  * For example, if you can't open ArpLibrary:                *
  166.  *    Alert( (AG_OpenLib|AO_ArpLib), 0L);                *
  167.  ************************************************************************
  168.  */
  169. #define    AO_ArpLib    0x00008036L        /* Alert object */
  170.  
  171. /*
  172.  ************************************************************************
  173.  *    Alerts that arp.library may return...                *
  174.  ************************************************************************
  175.  */
  176. #define    AN_ArpLib    0x03600000L    /* Alert number                */
  177. #define    AN_ArpNoMem    0x03610000L    /* No more memory            */
  178. #define    AN_ArpInputMem    0x03610002L    /* No memory for input buffer        */
  179. #define    AN_ArpNoMakeEnv    0x83610003L    /* No memory to make EnvLib        */
  180.  
  181. #define    AN_ArpNoDOS    0x83630001L    /* Can't open dos.library        */
  182. #define    AN_ArpNoGfx    0x83630002L    /* Can't open graphics.library        */
  183. #define    AN_ArpNoIntuit    0x83630003L    /* Can't open intuition            */
  184. #define    AN_BadPackBlues    0x83640000L    /* Bad packet returned to SendPacket()    */
  185. #define    AN_Zombie    0x83600003L    /* Zombie roaming around system        */
  186.  
  187. #define    AN_ArpScattered    0x83600002L    /* Scatter loading not allowed for arp    */
  188.  
  189.  
  190. /*
  191.  ************************************************************************
  192.  *    Return codes you can get from calling ARP Assign()...        *
  193.  ************************************************************************
  194.  */
  195. #define    ASSIGN_OK    0L    /* Everything is cool and groovey            */
  196. #define    ASSIGN_NODEV    1L    /* "Physical" is not valid for assignment        */
  197. #define    ASSIGN_FATAL    2L    /* Something really icky happened            */
  198. #define    ASSIGN_CANCEL    3L    /* Tried to cancel something but it won't cancel    */
  199.  
  200. /*
  201.  ************************************************************************
  202.  *    Size of buffer you need if you are going to call ReadLine()    *
  203.  ************************************************************************
  204.  */
  205. #define    MaxInputBuf    256L
  206.  
  207. /*
  208.  ************************************************************************
  209.  *    The ARP file requester data structure...            *
  210.  ************************************************************************
  211.  */
  212.  
  213.     /* This whole part has to be skipped if libraries/asl.h is
  214.      * pulled in before arpbase.h is included (which is the recommended
  215.      * sequence). -olsen
  216.      */
  217.  
  218. #ifndef LIBRARIES_ASL_H
  219.  
  220.     /* You know req.library? -olsen */
  221.  
  222. #ifndef REQLIBRARY_H    
  223.  
  224. struct FileRequester    {
  225.             BYTE    *fr_Hail;        /* Hailing text            */
  226.             BYTE    *fr_File;        /* Filename array (FCHARS + 1)    */
  227.             BYTE    *fr_Dir;        /* Directory array (DSIZE + 1)    */
  228.         struct    Window    *fr_Window;        /* Window requesting or NULL    */
  229.             UBYTE    fr_FuncFlags;        /* Set bitdef's below        */
  230.             UBYTE    fr_Flags2;        /* New flags...            */
  231.             VOID    (*fr_Function)();    /* Your function, see bitdef's    */
  232.             WORD    fr_LeftEdge;        /* To be used later...        */
  233.             WORD    fr_TopEdge;
  234.             };
  235.  
  236. #endif    /* REQLIBRARY_H */
  237.  
  238. /*
  239.  ************************************************************************
  240.  * The following are the defines for fr_FuncFlags.  These bits tell    *
  241.  * FileRequest() what your fr_UserFunc is expecting, and what        *
  242.  * FileRequest() should call it for.                    *
  243.  *                                    *
  244.  * You are called like so:                        *
  245.  * fr_Function(Mask, Object)                        *
  246.  * ULONG    Mask;                            *
  247.  * CPTR        *Object;                        *
  248.  *                                    *
  249.  * The Mask is a copy of the flag value that caused FileRequest() to    *
  250.  * call your function. You can use this to determine what action you    *
  251.  * need to perform, and exactly what Object is, so you know what to do    *
  252.  * and what to return.                            *
  253.  ************************************************************************
  254.  */
  255. #define    FRB_DoWildFunc    7L /* Call me with a FIB and a name, ZERO return accepts.    */
  256. #define    FRB_DoMsgFunc    6L /* You get all IDCMP messages not for FileRequest()        */
  257. #define    FRB_DoColor    5L /* Set this bit for that new and different look        */
  258. #define    FRB_NewIDCMP    4L /* Force a new IDCMP (only if fr_Window != NULL)        */
  259. #define    FRB_NewWindFunc    3L /* You get to modify the newwindow structure.        */
  260. #define    FRB_AddGadFunc    2L /* You get to add gadgets.                    */
  261. #define    FRB_GEventFunc    1L /* Function to call if one of your gadgets is selected.    */
  262. #define    FRB_ListFunc    0L /* Not implemented yet.                    */
  263.  
  264. #define    FRF_DoWildFunc    (1L << FRB_DoWildFunc)
  265. #define    FRF_DoMsgFunc    (1L << FRB_DoMsgFunc)
  266. #define    FRF_DoColor    (1L << FRB_DoColor)
  267. #define    FRF_NewIDCMP    (1L << FRB_NewIDCMP)
  268. #define    FRF_NewWindFunc    (1L << FRB_NewWindFunc)
  269. #define    FRF_AddGadFunc    (1L << FRB_AddGadFunc)
  270. #define    FRF_GEventFunc    (1L << FRB_GEventFunc)
  271. #define    FRF_ListFunc    (1L << FRB_ListFunc)
  272.  
  273. /*
  274.  ************************************************************************
  275.  * The FR2B_ bits are for fr_Flags2 in the file requester structure    *
  276.  ************************************************************************
  277.  */
  278. #define    FR2B_LongPath    0L /* Specify the fr_Dir buffer is 256 bytes long */
  279.  
  280. #define    FR2F_LongPath    (1L << FR2B_LongPath)
  281.  
  282. /*
  283.  ************************************************************************
  284.  *    The sizes of the different buffers...                *
  285.  ************************************************************************
  286.  */
  287. #define    FCHARS        32L    /* Filename size                */
  288. #define    DSIZE        33L    /* Directory name size if not FR2B_LongPath    */
  289.  
  290. #define    LONG_DSIZE    254L    /* If FR2B_LongPath is set, use LONG_DSIZE    */
  291. #define    LONG_FSIZE    126L    /* For compatibility with ARPbase.i        */
  292.  
  293. #define    FR_FIRST_GADGET    0x7680L    /* User gadgetID's must be less than this value    */
  294.  
  295. #endif    /* LIBRARIES_ASL_H */
  296.  
  297. /*
  298.  ************************************************************************
  299.  * Structure expected by FindFirst()/FindNext()                *
  300.  *                                    *
  301.  * You need to allocate this structure and initialize it as follows:    *
  302.  *                                    *
  303.  * Set ap_BreakBits to the signal bits (CDEF) that you want to take a    *
  304.  * break on, or NULL, if you don't want to convenience the user.    *
  305.  *                                    *
  306.  * if you want to have the FULL PATH NAME of the files you found,    *
  307.  * allocate a buffer at the END of this structure, and put the size of    *
  308.  * it into ap_StrLen.  If you don't want the full path name, make sure    *
  309.  * you set ap_StrLen to zero.  In this case, the name of the file, and    *
  310.  * stats are available in the ap_Info, as per usual.            *
  311.  *                                    *
  312.  * Then call FindFirst() and then afterwards, FindNext() with this    *
  313.  * structure.  You should check the return value each time (see below)    *
  314.  * and take the appropriate action, ultimately calling            *
  315.  * FreeAnchorChain() when there are no more files and you are done.    *
  316.  * You can tell when you are done by checking for the normal AmigaDOS    *
  317.  * return code ERROR_NO_MORE_ENTRIES.                    *
  318.  *                                    *
  319.  * You will also have to check the DirEntryType variable in the ap_Info    *
  320.  * structure to determine what exactly you have received.        *
  321.  ************************************************************************
  322.  */
  323. struct    AnchorPath    {
  324.         struct    AChain        *ap_Base;    /* Pointer to first anchor            */
  325.         struct    AChain        *ap_Last;    /* Pointer to last anchor            */
  326.             LONG        ap_BreakBits;    /* Bits to break on                */
  327.             LONG        ap_FoundBreak;    /* Bits we broke on. Also returns ERROR_BREAK    */
  328.             BYTE        ap_Flags;    /* New use for the extra word...        */
  329.             BYTE        ap_Reserved;    /* To fill it out...                */
  330.             WORD        ap_StrLen;    /* This is what used to be ap_Length        */
  331.         struct    FileInfoBlock    ap_Info;
  332.             BYTE        ap_Buf[1];    /* Allocate a buffer here, if desired        */
  333.             };
  334.  
  335. /*
  336.  ************************************************************************
  337.  *    Bit definitions for the new ap_Flags...                *
  338.  ************************************************************************
  339.  */
  340. #define    APB_DoWild    0L    /* User option ALL                */
  341. #define    APB_ItsWild    1L    /* Set by FindFirst, used by FindNext        */
  342. #define    APB_DoDir    2L    /* Bit is SET if a DIR node should be entered    */
  343.                 /* Application can RESET this bit to AVOID    */
  344.                 /* entering a dir.                */
  345. #define    APB_DidDir    3L    /* Bit is set for an "expired" dir node        */
  346. #define    APB_NoMemErr    4L    /* Set if there was not enough memory        */
  347. #define    APB_DoDot    5L    /* If set, '.' (DOT) will convert to CurrentDir    */
  348.  
  349. #define    APF_DoWild    (1L << APB_DoWild)
  350. #define    APF_ItsWild    (1L << APB_ItsWild)
  351. #define    APF_DoDir    (1L << APB_DoDir)
  352. #define    APF_DidDir    (1L << APB_DidDir)
  353. #define    APF_NoMemErr    (1L << APB_NoMemErr)
  354. #define    APF_DoDot    (1L << APB_DoDot)
  355.  
  356. /*
  357.  ************************************************************************
  358.  * Structure used by the pattern matching functions, no need to obtain,    *
  359.  * diddle or allocate this yourself.                    *
  360.  *                                    *
  361.  * Note:  If you did, you will now break as it has changed...        *
  362.  ************************************************************************
  363.  */
  364. #ifdef    ARP_PRIVATE
  365. struct    AChain    {
  366.     struct    AChain        *an_Child;
  367.     struct    AChain        *an_Parent;
  368.     struct    FileLock    *an_Lock;
  369.     struct    FileInfoBlock    *an_Info;
  370.         BYTE        an_Flags;
  371.         char        an_String[1];    /* Just as is .i file    */
  372.         };                /* ???  Don't use this!    */
  373. #endif    /* ARP_PRIVATE */
  374.  
  375. #define    DDB_PatternBit    0L
  376. #define    DDB_ExaminedBit    1L
  377. #define    DDB_Completed    2L
  378. #define    DDB_AllBit    3L
  379.  
  380. #define    DDF_PatternBit    (1L << DDB_PatternBit)
  381. #define    DDF_ExaminedBit    (1L << DDB_ExaminedBit)
  382. #define    DDF_Completed    (1L << DDB_Completed)
  383. #define    DDF_AllBit    (1L << DDB_AllBit)
  384.  
  385. /*
  386.  ************************************************************************
  387.  * This structure takes a pointer, and returns FALSE if wildcard was    *
  388.  * not found by FindFirst()                        *
  389.  ************************************************************************
  390.  */
  391. #define    IsWild( ptr )        ( *((LONG *)(ptr)) )
  392.  
  393. /*
  394.  ************************************************************************
  395.  * Constants used by wildcard routines                    *
  396.  *                                    *
  397.  * These are the pre-parsed tokens referred to by pattern match.  It    *
  398.  * is not necessary for you to do anything about these, FindFirst()    *
  399.  * FindNext() handle all these for you.                    *
  400.  ************************************************************************
  401.  */
  402. #define    P_ANY        0x80L    /* Token for '*' | '#?'    */
  403. #define    P_SINGLE    0x81L    /* Token for '?'    */
  404.  
  405. /*
  406.  ************************************************************************
  407.  * No need to muck with these as they may change...            *
  408.  ************************************************************************
  409.  */
  410. #ifdef    ARP_PRIVATE
  411. #define    P_ORSTART    0x82L    /* Token for '('    */
  412. #define    P_ORNEXT    0x83L    /* Token for '|'    */
  413. #define    P_OREND        0x84L    /* Token for ')'    */
  414. #define    P_NOT        0x85L    /* Token for '~'    */
  415. #define    P_NOTCLASS    0x87L    /* Token for '^'    */
  416. #define    P_CLASS        0x88L    /* Token for '[]'    */
  417. #define    P_REPBEG    0x89L    /* Token for '['    */
  418. #define    P_REPEND    0x8AL    /* Token for ']'    */
  419. #endif    /* ARP_PRIVATE */
  420.  
  421.     /* dos/dosasl.h uses a good lot of the symbols and structures
  422.      * defined here (AnchorPatch, AChain, ERROR_BREAK and the
  423.      * like), so let's don't include it again.
  424.      */
  425.  
  426. #define DOS_DOSASL_H 1
  427.  
  428. /*
  429.  ************************************************************************
  430.  * Structure used by AddDANode(), AddDADevs(), FreeDAList().        *
  431.  *                                    *
  432.  * This structure is used to create lists of names, which normally    *
  433.  * are devices, assigns, volumes, files, or directories.        *
  434.  ************************************************************************
  435.  */
  436. struct    DirectoryEntry    {
  437.         struct    DirectoryEntry    *de_Next;    /* Next in list                */
  438.             BYTE        de_Type;    /* DLX_mumble                */
  439.             BYTE        de_Flags;    /* For future expansion, DO NOT USE!    */
  440.             BYTE        de_Name[1];    /* The name of the thing found        */
  441.             };
  442.  
  443. /*
  444.  ************************************************************************
  445.  * Defines you use to get a list of the devices you want to look at.    *
  446.  * For example, to get a list of all directories and volumes, do:    *
  447.  *                                    *
  448.  *    AddDADevs( mydalist, (DLF_DIRS | DLF_VOLUMES) )            *
  449.  *                                    *
  450.  * After this, you can examine the de_type field of the elements added    *
  451.  * to your list (if any) to discover specifics about the objects added.    *
  452.  *                                    *
  453.  * Note that if you want only devices which are also disks, you must    *
  454.  * (DLF_DEVICES | DLF_DISKONLY).                    *
  455.  ************************************************************************
  456.  */
  457. #define    DLB_DEVICES    0L    /* Return devices                */
  458. #define    DLB_DISKONLY    1L    /* Modifier for above: Return disk devices only    */
  459. #define    DLB_VOLUMES    2L    /* Return volumes only                */
  460. #define    DLB_DIRS    3L    /* Return assigned devices only            */
  461.  
  462. #define    DLF_DEVICES    (1L << DLB_DEVICES)
  463. #define    DLF_DISKONLY    (1L << DLB_DISKONLY)
  464. #define    DLF_VOLUMES    (1L << DLB_VOLUMES)
  465. #define    DLF_DIRS    (1L << DLB_DIRS)
  466.  
  467. /*
  468.  ************************************************************************
  469.  * Legal de_Type values, check for these after a call to AddDADevs(),    *
  470.  * or use on your own as the ID values in AddDANode().            *
  471.  ************************************************************************
  472.  */
  473. #define    DLX_FILE    0L    /* AddDADevs() can't determine this    */
  474. #define    DLX_DIR        8L    /* AddDADevs() can't determine this    */
  475. #define    DLX_DEVICE    16L    /* It's a resident device        */
  476.  
  477. #define    DLX_VOLUME    24L    /* Device is a volume            */
  478. #define    DLX_UNMOUNTED    32L    /* Device is not resident        */
  479.  
  480. #define    DLX_ASSIGN    40L    /* Device is a logical assignment    */
  481.  
  482. /*
  483.  ************************************************************************
  484.  *    This macro is to check for an error return from the Atol()    *
  485.  *    routine.  If Errno is ERRBADINT, then there was an error...    *
  486.  *    This was done to try to remain as close to source compatible    *
  487.  *    as possible with the older (rel 1.1) ARPbase.h            *
  488.  ************************************************************************
  489.  */
  490. #define    ERRBADINT    1L
  491. #define    Errno        (IoErr() ? ERRBADINT : 0)
  492.  
  493. /*
  494.  ************************************************************************
  495.  *    Resource Tracking stuff...                    *
  496.  ************************************************************************
  497.  *                                    *
  498.  * There are a few things in arp.library that are only directly        *
  499.  * acessable from assembler.  The glue routines provided by us for    *
  500.  * all 'C' compilers use the following conventions to make these    *
  501.  * available to C programs.  The glue for other language's should use    *
  502.  * as similar a mechanism as possible, so that no matter what language    *
  503.  * or compiler we speak, when talk about arp, we will know what the    *
  504.  * other guy is saying.                            *
  505.  *                                    *
  506.  * Here are the cases:                            *
  507.  *                                    *
  508.  * Tracker calls...                            *
  509.  *        These calls return the Tracker pointer as a secondary    *
  510.  *        result in the register A1.  For C, there is no clean    *
  511.  *        way to return more than one result so the tracker    *
  512.  *        pointer is returned in IoErr().  For ease of use,    *
  513.  *        there is a define that typecasts IoErr() to the correct    *
  514.  *        pointer type.  This is called LastTracker and should    *
  515.  *        be source compatible with the earlier method of storing    *
  516.  *        the secondary result.                    *
  517.  *                                    *
  518.  * GetTracker() -                            *
  519.  *        Syntax is a bit different for C than the assembly call    *
  520.  *        The C syntax is GetTracker(ID).  The binding routines    *
  521.  *        will store the ID into the tracker on return.  Also,    *
  522.  *        in an effort to remain consistant, the tracker will    *
  523.  *        also be stored in LastTracker.                *
  524.  *                                    *
  525.  * In cases where you have allocated a tracker before you have obtained    *
  526.  * a resource (usually the most efficient method), and the resource has    *
  527.  * not been obtained, you will need to clear the tracker id.  The macro    *
  528.  * CLEAR_ID() has been provided for that purpose.  It expects a pointer    *
  529.  * to a DefaultTracker sort of struct.                    *
  530.  ************************************************************************
  531.  */
  532. #define    CLEAR_ID(t)    ((SHORT *) t)[-1]=NULL
  533.  
  534. /*
  535.  ************************************************************************
  536.  * You MUST prototype IoErr() to prevent the possible error in defining    *
  537.  * IoErr() and thus causing LastTracker to give you trash...        *
  538.  *                                    *
  539.  * N O T E !  You MUST! have IoErr() defined as LONG to use LastTracker *
  540.  *          If your compiler has other defines for this, you may wish *
  541.  *          to remove the prototype for IoErr().            *
  542.  ************************************************************************
  543.  */
  544. #define    LastTracker    ((struct DefaultTracker *)IoErr())
  545.  
  546. /*
  547.  ************************************************************************
  548.  * The rl_FirstItem list (ResList) is a list of TrackedResource (below)    *
  549.  * It is very important that nothing in this list depend on the task    *
  550.  * existing at resource freeing time (i.e., RemTask(0L) type stuff,    *
  551.  * DeletePort() and the rest).                        *
  552.  *                                    *
  553.  * The tracking functions return a struct Tracker *Tracker to you, this    *
  554.  * is a pointer to whatever follows the tr_ID variable.            *
  555.  * The default case is reflected below, and you get it if you call    *
  556.  * GetTracker() ( see DefaultTracker below).                *
  557.  *                                    *
  558.  * NOTE: The two user variables mentioned in an earlier version don't    *
  559.  * exist, and never did. Sorry about that (SDB).            *
  560.  *                                    *
  561.  * However, you can still use ArpAlloc() to allocate your own tracking    *
  562.  * nodes and they can be any size or shape you like, as long as the    *
  563.  * base structure is preserved. They will be freed automagically just    *
  564.  * like the default trackers.                        *
  565.  ************************************************************************
  566.  */
  567. struct    TrackedResource    {
  568.         struct    MinNode    tr_Node;    /* Double linked pointer        */
  569.             BYTE    tr_Flags;    /* Don't touch                */
  570.             BYTE    tr_Lock;    /* Don't touch, for Get/FreeAccess()    */
  571.             SHORT    tr_ID;        /* Item's ID                */
  572.  
  573. /*
  574.  ************************************************************************
  575.  * The struct DefaultTracker *Tracker portion of the structure.        *
  576.  * The stuff below this point can conceivably vary, depending        *
  577.  * on user needs, etc.  This reflects the default.            *
  578.  ************************************************************************
  579.  */
  580.             union    {
  581.                 CPTR    tr_Resource;    /* Whatever                */
  582.                     LONG    tg_Verify;    /* For use during TRAK_GENERIC        */
  583.                 }    tr_Object;    /* The thing being tracked        */
  584.             union    {
  585.                 VOID    (*tg_Function)();/* Function to call for TRAK_GENERIC    */
  586.             struct    Window    *tr_Window2;    /* For TRAK_WINDOW            */
  587.                 }    tr_Extra;    /* Only needed sometimes        */
  588.             };
  589.  
  590. #define    tg_Value tg_Verify    /* Ancient compatibility only!  Do NOT use in new CODE!!! */
  591.  
  592. /*
  593.  ************************************************************************
  594.  * You get a pointer to a struct of the following type when you call    *
  595.  * GetTracker().  You can change this, and use ArpAlloc() instead of    *
  596.  * GetTracker() to do tracking. Of course, you have to take a wee bit    *
  597.  * more responsibility if you do, as well as if you use TRAK_GENERIC    *
  598.  * stuff.                                *
  599.  *                                    *
  600.  * TRAK_GENERIC folks need to set up a task function to be called when    *
  601.  * an item is freed.  Some care is required to set this up properly.    *
  602.  *                                    *
  603.  * Some special cases are indicated by the unions below, for        *
  604.  * TRAK_WINDOW, if you have more than one window opened, and don't    *
  605.  * want the IDCMP closed particularly, you need to set a ptr to the    *
  606.  * other window in dt_Window2.  See CloseWindowSafely() for more info.    *
  607.  * If only one window, set this to NULL.                *
  608.  ************************************************************************
  609.  */
  610. struct    DefaultTracker    {
  611.             union    {
  612.                 CPTR    dt_Resource;    /* Whatever                */
  613.                 LONG    tg_Verify;    /* For use during TRAK_GENERIC        */
  614.                 }    dt_Object;    /* The object being tracked        */
  615.             union    {
  616.                 VOID    (*tg_Function)();/* Function to call for TRAK_GENERIC    */
  617.             struct    Window    *dt_Window2;    /* For TRAK_WINDOW            */
  618.                 }    dt_Extra;
  619.             };
  620.  
  621. /*
  622.  ************************************************************************
  623.  *    Items the tracker knows what to do about            *
  624.  ************************************************************************
  625.  */
  626. #define    TRAK_AAMEM    0L    /* Default (ArpAlloc) element        */
  627. #define    TRAK_LOCK    1L    /* File lock                */
  628. #define    TRAK_FILE    2L    /* Opened file                */
  629. #define    TRAK_WINDOW    3L    /* Window -- see docs            */
  630. #define    TRAK_SCREEN    4L    /* Screen                */
  631. #define    TRAK_LIBRARY    5L    /* Opened library            */
  632. #define    TRAK_DAMEM    6L    /* Pointer to DosAllocMem block        */
  633. #define    TRAK_MEMNODE    7L    /* AllocEntry() node            */
  634. #define    TRAK_SEGLIST    8L    /* Program segment            */
  635. #define    TRAK_RESLIST    9L    /* ARP (nested) ResList            */
  636. #define    TRAK_MEM    10L    /* Memory ptr/length            */
  637. #define    TRAK_GENERIC    11L    /* Generic Element, your choice        */
  638. #define    TRAK_DALIST    12L    /* DAlist ( aka file request )        */
  639. #define    TRAK_ANCHOR    13L    /* Anchor chain (pattern matching)    */
  640. #define    TRAK_FREQ    14L    /* FileRequest struct            */
  641. #define    TRAK_FONT    15L    /* GfxBase CloseFont()            */
  642. #define    TRAK_MAX    15L    /* Poof, anything higher is tossed    */
  643.  
  644. #define    TRB_UNLINK    7L    /* Free node bit            */
  645. #define    TRB_RELOC    6L    /* This may be relocated (not used yet)    */
  646. #define    TRB_MOVED    5L    /* Item moved                */
  647.  
  648. #define    TRF_UNLINK    (1L << TRB_UNLINK)
  649. #define    TRF_RELOC    (1L << TRB_RELOC)
  650. #define    TRF_MOVED    (1L << TRB_MOVED)
  651.  
  652. /*
  653.  ************************************************************************
  654.  * Note: ResList MUST be a DosAllocMem'ed list!, this is done for    *
  655.  * you when you call CreateTaskResList(), typically, you won't need    *
  656.  * to access/allocate this structure.                    *
  657.  ************************************************************************
  658.  */
  659. struct    ResList    {
  660.     struct    MinNode        rl_Node;    /* Used by arplib to link reslists    */
  661.     struct    Task        *rl_TaskID;    /* Owner of this list            */
  662.     struct    MinList        rl_FirstItem;    /* List of Tracked Resources        */
  663.     struct    ResList        *rl_Link;    /* SyncRun's use - hide list here    */
  664.         };
  665.  
  666. /*
  667.  ************************************************************************
  668.  *    Returns from CompareLock()                    *
  669.  ************************************************************************
  670.  */
  671. #define    LCK_EQUAL    0L    /* The two locks refer to the same object    */
  672. #define    LCK_VOLUME    1L    /* Locks are on the same volume            */
  673. #define    LCK_DIFVOL1    2L    /* Locks are on different volumes        */
  674. #define    LCK_DIFVOL2    3L    /* Locks are on different volumes        */
  675.  
  676. /*
  677.  ************************************************************************
  678.  *    ASyncRun() stuff...                        *
  679.  ************************************************************************
  680.  * Message sent back on your request by an exiting process.        *
  681.  * You request this by putting the address of your message in        *
  682.  * pcb_LastGasp, and initializing the ReplyPort variable of your    *
  683.  * ZombieMsg to the port you wish the message posted to.        *
  684.  ************************************************************************
  685.  */
  686. struct    ZombieMsg    {
  687.         struct    Message        zm_ExecMessage;
  688.             ULONG        zm_TaskNum;    /* Task ID            */
  689.             LONG        zm_ReturnCode;    /* Process's return code    */
  690.             ULONG        zm_Result2;    /* System return code        */
  691.         struct    DateStamp    zm_ExitTime;    /* Date stamp at time of exit    */
  692.             ULONG        zm_UserInfo;    /* For whatever you wish    */
  693.             };
  694.  
  695. /*
  696.  ************************************************************************
  697.  * Structure required by ASyncRun() -- see docs for more info.        *
  698.  ************************************************************************
  699.  */
  700. struct    ProcessControlBlock    {
  701.                 ULONG        pcb_StackSize;    /* Stacksize for new process            */
  702.                 BYTE        pcb_Pri;    /* Priority of new task                */
  703.                 UBYTE        pcb_Control;    /* Control bits, see defines below        */
  704.                 APTR        pcb_TrapCode;    /* Optional Trap Code                */
  705.                 BPTR        pcb_Input;
  706.                 BPTR        pcb_Output;    /* Optional stdin, stdout            */
  707.                 union    {
  708.                     BPTR    pcb_SplatFile;    /* File to use for Open("*")            */
  709.                     BYTE    *pcb_ConName;    /* CON: filename                */
  710.                     }    pcb_Console;
  711.                 CPTR        pcb_LoadedCode;    /* If not null, will not load/unload code    */
  712.             struct    ZombieMsg    *pcb_LastGasp;    /* ReplyMsg() to be filled in by exit        */
  713.             struct    MsgPort        *pcb_WBProcess;    /* Valid only when PRB_NOCLI            */
  714.                 };
  715.  
  716. /*
  717.  ************************************************************************
  718.  * Formerly needed to pass NULLCMD to a child.  No longer needed.    *
  719.  * It is being kept here for compatibility only...            *
  720.  ************************************************************************
  721.  */
  722. #define    NOCMD    "\n"
  723.  
  724. /*
  725.  ************************************************************************
  726.  * The following control bits determine what ASyncRun() does on        *
  727.  * Abnormal Exits and on background process termination.        *
  728.  ************************************************************************
  729.  */
  730. #define    PRB_SAVEIO    0L    /* Don't free/check file handles on exit    */
  731. #define    PRB_CLOSESPLAT    1L    /* Close Splat file, must request explicitly    */
  732. #define    PRB_NOCLI    2L    /* Don't create a CLI process            */
  733. /*    PRB_INTERACTIVE    3L       This is now obsolete...            */
  734. #define    PRB_CODE    4L    /* Dangerous yet enticing            */
  735. #define    PRB_STDIO    5L    /* Do the stdio thing, splat = CON:Filename     */
  736.  
  737. #define    PRF_SAVEIO    (1L << PRB_SAVEIO)
  738. #define    PRF_CLOSESPLAT    (1L << PRB_CLOSESPLAT)
  739. #define    PRF_NOCLI    (1L << PRB_NOCLI)
  740. #define    PRF_CODE    (1L << PRB_CODE)
  741. #define    PRF_STDIO    (1L << PRB_STDIO)
  742.  
  743. /*
  744.  ************************************************************************
  745.  *    Error returns from SyncRun() and ASyncRun()            *
  746.  ************************************************************************
  747.  */
  748. #define    PR_NOFILE    -1L    /* Could not LoadSeg() the file            */
  749. #define    PR_NOMEM    -2L    /* No memory for something            */
  750. /*    PR_NOCLI    -3L       This is now obsolete                */
  751. #define    PR_NOSLOT    -4L    /* No room in TaskArray                */
  752. #define    PR_NOINPUT    -5L    /* Could not open input file            */
  753. #define    PR_NOOUTPUT    -6L    /* Could not get output file            */
  754. /*    PR_NOLOCK    -7L       This is now obsolete                */
  755. /*    PR_ARGERR    -8L       This is now obsolete                */
  756. /*    PR_NOBCPL    -9L       This is now obsolete                */
  757. /*    PR_BADLIB    -10L       This is now obsolete                */
  758. #define    PR_NOSTDIO    -11L    /* Couldn't get stdio handles            */
  759.  
  760. /*
  761.  ************************************************************************
  762.  *    Added V35 of arp.library                    *
  763.  ************************************************************************
  764.  */
  765. #define    PR_WANTSMESSAGE    -12L    /* Child wants you to report IoErr() to user    */
  766.                 /* for SyncRun() only...            */
  767. #define    PR_NOSHELLPROC    -13L    /* Can't create a shell/cli process        */
  768. #define    PR_NOEXEC    -14L    /* 'E' bit is clear                */
  769. #define    PR_SCRIPT    -15L    /* S and E are set, IoErr() contains directory    */
  770.  
  771. /*
  772.  ************************************************************************
  773.  * Version 35 ASyncRun() allows you to create an independent        *
  774.  * interactive or background Shell/CLI. You need this variant of the    *
  775.  * pcb structure to do it, and you also have new values for nsh_Control,*
  776.  * see below.                                *
  777.  *                                    *
  778.  * Syntax for Interactive shell is:                    *
  779.  *                                    *
  780.  * rc=ASyncRun("Optional Window Name","Optional From File",&NewShell);    *
  781.  *                                    *
  782.  * Syntax for a background shell is:                    *
  783.  *                                    *
  784.  * rc=ASyncRun("Command line",0L,&NewShell);                *
  785.  *                                    *
  786.  * Same syntax for an Execute style call, but you have to be on drugs    *
  787.  * if you want to do that.                        *
  788.  ************************************************************************
  789.  */
  790. struct    NewShell    {
  791.             ULONG    nsh_StackSize;    /* stacksize shell will use for children    */
  792.             BYTE    nsh_Pri;    /* ignored by interactive shells        */
  793.             UBYTE    nsh_Control;    /* bits/values: see above            */
  794.             CPTR    nsh_LogMsg;    /* Optional login message, if null, use default    */
  795.             BPTR    nsh_Input;    /* ignored by interactive shells, but        */
  796.             BPTR    nsh_Output;    /* used by background and execute options.    */
  797.             LONG    nsh_RESERVED[5];
  798.             };
  799.  
  800. /*
  801.  ************************************************************************
  802.  * Bit Values for nsh_Control, you should use them as shown below, or    *
  803.  * just use the actual values indicated.                *
  804.  ************************************************************************
  805.  */
  806. #define    PRB_CLI        0L    /* Do a CLI, not a shell    */
  807. #define    PRB_BACKGROUND    1L    /* Background shell        */
  808. #define    PRB_EXECUTE    2L    /* Do as EXECUTE...        */
  809. #define    PRB_INTERACTIVE    3L    /* Run an interactive shell    */
  810. #define    PRB_FB        7L    /* Alt function bit...        */
  811.  
  812. #define    PRF_CLI        (1L << PRB_CLI)
  813. #define    PRF_BACKGOUND    (1L << PRB_BACKGROUND)
  814. #define    PRF_EXECUTE    (1L << PRB_EXECUTE)
  815. #define    PRF_INTERACTIVE    (1L << PRB_INTERACTIVE)
  816. #define    PRF_FB        (1L << PRB_FB)
  817.  
  818. /*
  819.  ************************************************************************
  820.  *    Common values for sh_Control which allow you to do usefull    *
  821.  *    and somewhat "standard" things...                *
  822.  ************************************************************************
  823.  */
  824. #define    INTERACTIVE_SHELL    (PRF_FB|PRF_INTERACTIVE)        /* Gimme a newshell!        */
  825. #define    INTERACTIVE_CLI        (PRF_FB|PRF_INTERACTIVE|PRF_CLI)    /* Gimme that ol newcli!    */
  826. #define    BACKGROUND_SHELL    (PRF_FB|PRF_BACKGROUND)            /* gimme a background shell    */
  827. #define    EXECUTE_ME        (PRF_FB|PRF_BACKGROUND|PRF_EXECUTE)    /* aptly named, doncha think?    */
  828.  
  829. /*
  830.  ************************************************************************
  831.  *    Additional IoErr() returns added by ARP...            *
  832.  ************************************************************************
  833.  */
  834. #define    ERROR_BUFFER_OVERFLOW    303L    /* User or internal buffer overflow    */
  835. #define    ERROR_BREAK        304L    /* A break character was received    */
  836. #define    ERROR_NOT_EXECUTABLE    305L    /* A file has E bit cleared        */
  837. #define    ERROR_NOT_CLI        400L    /* Program/function neeeds to be cli    */
  838.  
  839. /*
  840.  ************************************************************************
  841.  *    Resident Program Support                    *
  842.  ************************************************************************
  843.  * This is the kind of node allocated for you when you AddResidentPrg()    *
  844.  * a code segment.  They are stored as a single linked list with the    *
  845.  * root in ArpBase.  If you absolutely *must* wander through this list    *
  846.  * instead of using the supplied functions, then you must first obtain    *
  847.  * the semaphore which protects this list, and then release it        *
  848.  * afterwards.  Do not use Forbid() and Permit() to gain exclusive    *
  849.  * access!  Note that the supplied functions handle this locking    *
  850.  * protocol for you.                            *
  851.  ************************************************************************
  852.  */
  853. struct    ResidentProgramNode    {
  854.             struct    ResidentProgramNode    *rpn_Next;    /* next or NULL            */
  855.                 LONG            rpn_Usage;    /* Number of current users    */
  856.                 UWORD            rpn_AccessCnt;    /* Total times used...        */
  857.                 ULONG            rpn_CheckSum;    /* Checksum of code        */
  858.                 BPTR            rpn_Segment;    /* Actual segment        */
  859.                 UWORD            rpn_Flags;    /* See definitions below...    */
  860.                 BYTE            rpn_Name[1];    /* Allocated as needed        */
  861.                 };
  862.  
  863. /*
  864.  ************************************************************************
  865.  *    Bit definitions for rpn_Flags....                *
  866.  ************************************************************************
  867.  */
  868. #define    RPNB_NOCHECK    0L    /* Set in rpn_Flags for no checksumming...    */
  869. #define    RPNB_CACHE    1L    /* Private usage in v1.3...            */
  870.  
  871. #define    RPNF_NOCHECK    (1L << RPNB_NOCHECK)
  872. #define    RPNF_CACHE    (1L << RPNB_CACHE)
  873.  
  874. /*
  875.  ************************************************************************
  876.  * If your program starts with this structure, ASyncRun() and SyncRun()    *
  877.  * will override a users stack request with the value in rpt_StackSize.    *
  878.  * Furthermore, if you are actually attached to the resident list, a    *
  879.  * memory block of size rpt_DataSize will be allocated for you, and    *
  880.  * a pointer to this data passed to you in register A4.  You may use    *
  881.  * this block to clone the data segment of programs, thus resulting in    *
  882.  * one copy of text, but multiple copies of data/bss for each process    *
  883.  * invocation.  If you are resident, your program will start at        *
  884.  * rpt_Instruction, otherwise, it will be launched from the initial    *
  885.  * branch.                                *
  886.  ************************************************************************
  887.  */
  888. struct    ResidentProgramTag    {
  889.                 BPTR    rpt_NextSeg;    /* Provided by DOS at LoadSeg time    */
  890. /*
  891.  ************************************************************************
  892.  * The initial branch destination and rpt_Instruction do not have to be    *
  893.  * the same.  This allows different actions to be taken if you are    *
  894.  * diskloaded or resident.  DataSize memory will be allocated only if    *
  895.  * you are resident, but StackSize will override all user stack        *
  896.  * requests.                                *
  897.  ************************************************************************
  898.  */
  899.                 UWORD    rpt_BRA;    /* Short branch to executable        */
  900.                 UWORD    rpt_Magic;    /* Resident majik value            */
  901.                 ULONG    rpt_StackSize;    /* min stack for this process        */
  902.                 ULONG    rpt_DataSize;    /* Data size to allocate if resident    */
  903.                 /*    rpt_Instruction;    Start here if resident        */
  904.                 };
  905.  
  906. /*
  907.  ************************************************************************
  908.  * The form of the ARP allocated node in your tasks memlist when    *
  909.  * launched as a resident program. Note that the data portion of the    *
  910.  * node will only exist if you have specified a nonzero value for    *
  911.  * rpt_DataSize. Note also that this structure is READ ONLY, modify    *
  912.  * values in this at your own risk.  The stack stuff is for tracking,    *
  913.  * if you need actual addresses or stack size, check the normal places    *
  914.  * for it in your process/task struct.                    *
  915.  ************************************************************************
  916.  */
  917. struct    ProcessMemory    {
  918.         struct    Node    pm_Node;
  919.             UWORD    pm_Num;        /* This is 1 if no data, two if data    */
  920.             CPTR    pm_Stack;
  921.             ULONG    pm_StackSize;
  922.             CPTR    pm_Data;    /* Only here if pm_Num == 2        */
  923.             ULONG    pm_DataSize;
  924.             };
  925.  
  926. /*
  927.  ************************************************************************
  928.  * To find the above on your memlist, search for the following name.    *
  929.  * We guarantee this will be the only arp.library allocated node on    *
  930.  * your memlist with this name.                        *
  931.  * i.e. FindName(task->tcb_MemEntry, PMEM_NAME);            *
  932.  ************************************************************************
  933.  */
  934. #define    PMEM_NAME    "ARP_MEM"
  935.  
  936. #define    RESIDENT_MAGIC    0x4AFC        /* same as RTC_MATCHWORD (trapf) */
  937.  
  938. /*
  939.  ************************************************************************
  940.  *    Date String/Data structures                    *
  941.  ************************************************************************
  942.  */
  943. struct    DateTime    {
  944.         struct    DateStamp    dat_Stamp;    /* DOS Datestamp            */
  945.             UBYTE        dat_Format;    /* controls appearance ot dat_StrDate    */
  946.             UBYTE        dat_Flags;    /* See BITDEF's below            */
  947.             BYTE        *dat_StrDay;    /* day of the week string        */
  948.             BYTE        *dat_StrDate;    /* date string                */
  949.             BYTE        *dat_StrTime;    /* time string                */
  950.             };
  951.  
  952. /*
  953.  ************************************************************************
  954.  *    Size of buffer you need for each DateTime strings:        *
  955.  ************************************************************************
  956.  */
  957. #define    LEN_DATSTRING    10L
  958.  
  959. /*
  960.  ************************************************************************
  961.  *    For dat_Flags                            *
  962.  ************************************************************************
  963.  */
  964. #define    DTB_SUBST    0L    /* Substitute "Today" "Tomorrow" where appropriate    */
  965. #define    DTB_FUTURE    1L    /* Day of the week is in future                */
  966.  
  967. #define    DTF_SUBST    (1L << DTB_SUBST)
  968. #define    DTF_FUTURE    (1L << DTB_FUTURE)
  969.  
  970. /*
  971.  ************************************************************************
  972.  *    For dat_Format                            *
  973.  ************************************************************************
  974.  */
  975. #define    FORMAT_DOS    0L        /* dd-mmm-yy AmigaDOS's own, unique style        */
  976. #define    FORMAT_INT    1L        /* yy-mm-dd International format            */
  977. #define    FORMAT_USA    2L        /* mm-dd-yy The good'ol'USA.                */
  978. #define    FORMAT_CDN    3L        /* dd-mm-yy Our brothers and sisters to the north    */
  979. #define    FORMAT_MAX    FORMAT_CDN    /* Larger than this? Defaults to AmigaDOS        */
  980.  
  981.     /* dos/datetime.h uses the same structures and defines, so
  982.      * keep the compiler from pulling it in. -olsen
  983.      */
  984.  
  985. #define DOS_DATETIME_H 1
  986.  
  987. /*
  988.  ************************************************************************
  989.  * Define NO_PROTOTYPES if your compiler does not handle them...    *
  990.  ************************************************************************
  991.  */
  992. #if defined(NO_PROTOTYPES) || defined(__NO_PROTOS)
  993. #define    ARGs(x)    ()
  994. #else
  995. #define    ARGs(x)    x
  996.  
  997.     /* Added ArpVPrintf, ArpVFPrintf and ArpVSPrintf, so will have to
  998.      * include the compiler specific stdarg header file. -olsen
  999.      */
  1000.  
  1001. #include <stdarg.h>
  1002.  
  1003. #endif    /* NO_PROTOTYPES */
  1004.  
  1005. /*
  1006.  ************************************************************************
  1007.  * Note that C_Args is a #define that, in LATTICE does __stdargs    *
  1008.  ************************************************************************
  1009.  */
  1010.  
  1011. /*
  1012.  ************************************************************************
  1013.  * This prototype is here to prevent the possible error in defining    *
  1014.  * IoErr() as LONG and thus causing LastTracker to give you trash...    *
  1015.  *                                    *
  1016.  * N O T E !  You MUST! have IoErr() defined as LONG to use LastTracker *
  1017.  *          If your compiler has other defines for this, you may wish *
  1018.  *          to move the prototype for IoErr() into the DO_ARP_COPIES    *
  1019.  ************************************************************************
  1020.  */
  1021.     LONG            IoErr            ARGs(    (VOID)                            );
  1022.  
  1023. /*
  1024.  ************************************************************************
  1025.  *    These duplicate the calls in dos.library            *
  1026.  *    Only include if you can use arp.library without dos.library    *
  1027.  ************************************************************************
  1028.  */
  1029. #ifdef    DO_ARP_COPIES
  1030.     BPTR            Open            ARGs(    (char *, LONG)                        );
  1031.     VOID            Close            ARGs(    (BPTR)                            );
  1032.     LONG            Read            ARGs(    (BPTR, char *, LONG)                    );
  1033.     LONG            Write            ARGs(    (BPTR, char *, LONG)                    );
  1034.     BPTR            Input            ARGs(    (VOID)                            );
  1035.     BPTR            Output            ARGs(    (VOID)                            );
  1036.     LONG            Seek            ARGs(    (BPTR, LONG, LONG)                    );
  1037.     LONG            DeleteFile        ARGs(    (char *)                        );
  1038.     LONG            Rename            ARGs(    (char *, char *)                    );
  1039.     BPTR            Lock            ARGs(    (char *, LONG)                        );
  1040.     VOID            UnLock            ARGs(    (BPTR)                            );
  1041.     BPTR            DupLock            ARGs(    (BPTR)                            );
  1042.     LONG            Examine            ARGs(    (BPTR, struct FileInfoBlock *)                );
  1043.     LONG            ExNext            ARGs(    (BPTR, struct FileInfoBlock *)                );
  1044.     LONG            Info            ARGs(    (BPTR, struct InfoData *)                );
  1045.     BPTR            CreateDir        ARGs(    (char *)                        );
  1046.     BPTR            CurrentDir        ARGs(    (BPTR)                            );
  1047. struct    MsgPort            *CreateProc        ARGs(    (char *, LONG, BPTR, LONG)                );
  1048.     VOID            Exit            ARGs(    (LONG)                            );
  1049.     BPTR            LoadSeg            ARGs(    (char *)                        );
  1050.     VOID            UnLoadSeg        ARGs(    (BPTR)                            );
  1051. struct    MsgPort            *DeviceProc        ARGs(    (char *)                        );
  1052.     LONG            SetComment        ARGs(    (char *, char *)                    );
  1053.     LONG            SetProtection        ARGs(    (char *, LONG)                        );
  1054.     LONG            *DateStamp        ARGs(    (LONG *)                        );
  1055.     VOID            Delay            ARGs(    (LONG)                            );
  1056.     LONG            WaitForChar        ARGs(    (BPTR, LONG)                        );
  1057.     BPTR            ParentDir        ARGs(    (BPTR)                            );
  1058.     LONG            IsInteractive        ARGs(    (BPTR)                            );
  1059.     LONG            Execute            ARGs(    (char *, BPTR, BPTR)                    );
  1060. #endif    /* DO_ARP_COPIES */
  1061.  
  1062. /*
  1063.  ************************************************************************
  1064.  *    Now for the stuff that only exists in arp.library...        *
  1065.  ************************************************************************
  1066.  */
  1067.     LONG        C_Args    Printf            ARGs(    (char *,...)                        );
  1068.     LONG        C_Args    FPrintf            ARGs(    (BPTR, char *,...)                    );
  1069.     LONG            Puts             ARGs(    (char *)                        );
  1070.     LONG            ReadLine        ARGs(    (char *)                        );
  1071.     LONG            GADS             ARGs(    (char *, LONG, char *, char **, char *)            );
  1072.     LONG            Atol            ARGs(    (char *)                        );
  1073.     ULONG            EscapeString         ARGs(    (char *)                        );
  1074.     LONG            CheckAbort        ARGs(    (VOID(*))                        );
  1075.     LONG            CheckBreak        ARGs(    (LONG, VOID(*))                        );
  1076.     BYTE            *Getenv            ARGs(    (char *, char *, LONG)                    );
  1077.     BOOL            Setenv            ARGs(    (char *, char *)                    );
  1078.     BYTE            *FileRequest         ARGs(    (struct FileRequester *)                );
  1079.     VOID            CloseWindowSafely    ARGs(    (struct Window *, LONG)                    );
  1080. struct    MsgPort            *CreatePort        ARGs(    (char *, LONG)                        );
  1081.     VOID            DeletePort         ARGs(    (struct MsgPort *)                    );
  1082.     LONG            SendPacket         ARGs(    (LONG, LONG *, struct MsgPort *)            );
  1083.     VOID            InitStdPacket        ARGs(    (LONG, LONG *, struct DosPacket *, struct MsgPort *)    );
  1084.     ULONG            PathName        ARGs(    (BPTR, char *,LONG)                    );
  1085.     ULONG            Assign            ARGs(    (char *, char *)                    );
  1086.     VOID            *DosAllocMem        ARGs(    (LONG)                            );
  1087.     VOID            DosFreeMem        ARGs(    (VOID *)                        );
  1088.     ULONG            BtoCStr            ARGs(    (char *, BSTR, LONG)                    );
  1089.     ULONG            CtoBStr            ARGs(    (char *, BSTR, LONG)                    );
  1090. struct    DeviceList        *GetDevInfo        ARGs(    (struct DeviceList *)                    );
  1091.     BOOL            FreeTaskResList        ARGs(    (VOID)                            );
  1092.     VOID            ArpExit         ARGs(    (LONG,LONG)                        );
  1093.     VOID        C_Args    *ArpAlloc        ARGs(    (LONG)                            );
  1094.     VOID        C_Args    *ArpAllocMem        ARGs(    (LONG, LONG)                        );
  1095.     BPTR        C_Args    ArpOpen            ARGs(    (char *, LONG)                        );
  1096.     BPTR        C_Args    ArpDupLock        ARGs(    (BPTR)                            );
  1097.     BPTR        C_Args    ArpLock            ARGs(    (char *, LONG)                        );
  1098.     VOID        C_Args    *RListAlloc        ARGs(    (struct ResList *, LONG)                );
  1099. struct    Process            *FindCLI        ARGs(    (LONG)                            );
  1100.     BOOL            QSort            ARGs(    (VOID *, LONG, LONG, int(*))                );
  1101.     BOOL            PatternMatch        ARGs(    (char *,char *)                        );
  1102.     LONG            FindFirst        ARGs(    (char *, struct AnchorPath *)                );
  1103.     LONG            FindNext        ARGs(    (struct AnchorPath *)                    );
  1104.     VOID            FreeAnchorChain        ARGs(    (struct AnchorPath *)                    );
  1105.     ULONG            CompareLock        ARGs(    (BPTR, BPTR)                        );
  1106. struct    ResList            *FindTaskResList    ARGs(    (VOID)                            );
  1107. struct    ResList            *CreateTaskResList    ARGs(    (VOID)                            );
  1108.     VOID            FreeResList        ARGs(    (struct ResList *)                    );
  1109.     VOID            FreeTrackedItem        ARGs(    (struct DefaultTracker *)                );
  1110. struct    DefaultTracker    C_Args    *GetTracker        ARGs(    (LONG)                            );
  1111.     VOID            *GetAccess        ARGs(    (struct DefaultTracker *)                );
  1112.     VOID            FreeAccess        ARGs(    (struct DefaultTracker *)                );
  1113.     VOID            FreeDAList        ARGs(    (struct DirectoryEntry *)                );
  1114. struct    DirectoryEntry        *AddDANode        ARGs(    (char *, struct DirectoryEntry **, LONG, LONG)        );
  1115.     ULONG            AddDADevs        ARGs(    (struct DirectoryEntry **, LONG)            );
  1116.     LONG            Strcmp            ARGs(    (char *, char *)                    );
  1117.     LONG            Strncmp            ARGs(    (char *, char *, LONG)                    );
  1118.     BYTE            Toupper            ARGs(    (BYTE)                            );
  1119.     LONG            SyncRun            ARGs(    (char *, char *, BPTR, BPTR)                );
  1120.  
  1121. /*
  1122.  ************************************************************************
  1123.  *    Added V32 of arp.library                    *
  1124.  ************************************************************************
  1125.  */
  1126.     LONG            ASyncRun        ARGs(    (char *, char *, struct ProcessControlBlock *)        );
  1127.     LONG            SpawnShell        ARGs(    (char *, char *, struct NewShell *)            );
  1128.     BPTR            LoadPrg            ARGs(    (char *)                        );
  1129.     BOOL            PreParse        ARGs(    (char *, char *)                    );
  1130.  
  1131. /*
  1132.  ************************************************************************
  1133.  *    Added V33 of arp.library                    *
  1134.  ************************************************************************
  1135.  */
  1136.     BOOL            StamptoStr        ARGs(    (struct DateTime *)                    );
  1137.     BOOL            StrtoStamp        ARGs(    (struct DateTime *)                    );
  1138. struct    ResidentProgramNode    *ObtainResidentPrg    ARGs(    (char *)                        );
  1139. struct    ResidentProgramNode    *AddResidentPrg        ARGs(    (BPTR, char *)                        );
  1140.     LONG            RemResidentPrg        ARGs(    (char *)                        );
  1141.     VOID            UnLoadPrg        ARGs(    (BPTR)                            );
  1142.     LONG            LMult            ARGs(    (LONG, LONG)                        );
  1143.     LONG            LDiv            ARGs(    (LONG, LONG)                        );
  1144.     LONG            LMod            ARGs(    (LONG, LONG)                        );
  1145.     ULONG            CheckSumPrg        ARGs(    (struct ResidentProgramNode *)                );
  1146.     VOID            TackOn            ARGs(    (char *, char *)                    );
  1147.     BYTE            *BaseName        ARGs(    (char *)                        );
  1148. struct    ResidentProgramNode    *ReleaseResidentPrg    ARGs(    (BPTR)                            );
  1149.  
  1150. /*
  1151.  ************************************************************************
  1152.  *    Added V36 of arp.library                    *
  1153.  ************************************************************************
  1154.  */
  1155.     LONG        C_Args    SPrintf            ARGs(    (char *, char *,...)                    );
  1156.     LONG            GetKeywordIndex        ARGs(    (char *, char *)                    );
  1157. struct    Library        C_Args    *ArpOpenLibrary        ARGs(    (char *, LONG)                        );
  1158. struct    FileRequester    C_Args    *ArpAllocFreq        ARGs(    (VOID)                            );
  1159.  
  1160.     /* This one's a cutie which is supported via bypassing the
  1161.      * ??Printf glue routines. -olsen
  1162.      */
  1163.  
  1164.     LONG            ArpVPrintf        ARGs(    (char *, va_list)                    );
  1165.     LONG            ArpVFPrintf        ARGs(    (BPTR, char *, va_list)                    );
  1166.     LONG            ArpVSPrintf        ARGs(    (char *, char *, va_list)                );
  1167.  
  1168. /*
  1169.  ************************************************************************
  1170.  *    Check if we should do the pragmas...                *
  1171.  ************************************************************************
  1172.  */
  1173.  
  1174. #if !defined(NO_PRAGMAS) && !defined(__NO_PRAGMAS)
  1175. #ifndef    PROTO_ARP_H
  1176. #include <proto/arp.h>
  1177. #endif    /* PROTO_ARP_H */
  1178. #endif    /* NO_PRAGMAS */
  1179.  
  1180. #endif    /* LIBRARIES_ARPBASE_H */
  1181.